//
//  MovieCell.m
//  Movie
//
//  Created by tengyang on 15/7/20.
//  Copyright (c) 2015年 tengyang. All rights reserved.
//

#import "MovieCell.h"
#import "UIImageView+WebCache.h"
#import "starView.h"

@implementation MovieCell

- (void)awakeFromNib {
    //不能进行选中
    self.selectionStyle=UITableViewCellSelectionStyleNone;
    
}

//给modal赋值时不能在awakeFromNib中进行赋值，要用一下的方法进行赋值
- (void)setModal:(movieModal *)modal
{
    _modal=modal;
    [self setNeedsLayout];
    
}

- (void)layoutSubviews
{
    
    [super layoutSubviews];
    _titleLable.text=_modal.title;
    _yearLable.text=[NSString stringWithFormat:@"年份:%@",_modal.year];
    NSString *str=[NSString stringWithFormat:@"%.1f",_modal.average];
    _averageLable.text=str;
    
    NSString *small=[_modal.images objectForKey:@"small"];
    [_iconImageView sd_setImageWithURL:[NSURL URLWithString:small]];
    
    
    starView *star=[[starView alloc]initWithFrame:_starView.bounds];
    star.average=_modal.average;
    [_starView addSubview:star];
   
    
    

    
    
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
    
    // Configure the view for the selected state
}

@end
